
import socket
import posnet_overlay_messages
import posnet_tcp_client
import random

if __name__  == "__main__":
	import sys
	host = sys.argv[1] # server address
	port = int(sys.argv[2]) # server port
	X = range(1,10)
	Y = range(1,10)
	space_point = [ random.choice(X),random.choice(Y) ]
	handle = ""
	# create detail of the add handle operation
	add_handle_message = posnet_overlay_messages.posnet_add_handle(space_point,handle)
	# create the posnet_message
	message = posnet_overlay_messages.posnet_overlay_add_handle_message(("",0),(host,port), add_handle_message)
	# send the message
	posnet_tcp_client.send_tcp_message( (host,port), message)
